package com.jintian.smart.kernel.security.provider;

import com.jintian.smart.base.api.security.constant.LoginLogResultEnum;
import com.jintian.smart.base.api.security.entity.LoginLogEntity;
import com.jintian.smart.base.api.security.provider.ILoginLogProvider;
import com.jintian.smart.base.api.security.view.LoginLogVO;
import com.jintian.smart.kernel.core.enumeration.UserTypeEnum;
import com.jintian.smart.kernel.security.service.LoginLogService;
import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboService;

@DubboService(timeout = 6000)
public class LoginLogProvider implements ILoginLogProvider {
    @Resource
    private LoginLogService loginLogService;

    /**
     * 查询上一个登录记录
     */
    @Override
    public LoginLogVO queryLastByUserId(Long userId, UserTypeEnum userTypeEnum, LoginLogResultEnum loginLogResultEnum) {
        return loginLogService.queryLastByUserId(userId, userTypeEnum, loginLogResultEnum);
    }

    /**
     * 添加日志
     */
    @Override
    public void log(LoginLogEntity loginLogEntity) {
        loginLogService.log(loginLogEntity);
    }
}
